import Vue from "vue";

const isDevMod = process.env.NODE_ENV === "development";
/**
 * 根据当前运行环境决定使用哪个Host，开发环境 host是/api ,  正式环境是xx 某一层的相对路径
 */
const host = isDevMod ? '/api' : ".";
const permissionHost = isDevMod ? '/permission' : ".";
const API = {
  loginYzm: `${host}/servlet/CreateImage`,
  loginUrl: `${host}/admin/login.do`,
  logoutUrl: `${host}/admin/logout.do`,
  checklogin: `${host}/admin/checklogin.do`,
  // user
  getUserByPage: `${host}/user/page.do`,
  addUser: `${host}/user/add.do`,
  updateDept: `${host}/user/update.do`,
  removeDept: `${host}/user/remove.do`,

  // dept
  getDeptByPage: `${host}/dept/page.do`,
  getParentDeptPage: `${host}/dept/parentDeptPage.do`,
  getSecondDeptPage: `${host}/dept/secondDeptPage.do`,
  addDept: `${host}/dept/add.do`,
  addSecondDept: `${host}/dept/addSecond.do`,
  listDept: `${host}/dept/list.do`,
  updateDept: `${host}/dept/update.do`,
  removeDept: `${host}/dept/remove.do`,
  //是否登录
  isLogin: `${host}/login/checkLogin.do`,
  getPermission: `${permissionHost}`

};
Vue.prototype.$api = API;
Vue.api = API;
export default API;
